home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / tos / othergnu / ispell.zoo / ispell.elc < prev    next >
Encoding:
Text File  |  1990-03-07  |  10.1 KB  |  139 lines

  1.  
  2. (provide (quote ispell))
  3.  
  4. (defconst ispell-version "2.0.01")
  5.  
  6. (defconst ispell-out-name " *ispell*" "\
  7. Name of the buffer that is associated with the 'ispell' process")
  8.  
  9. (defconst ispell-temp-name " *ispell-temp*" "\
  10. Name of the temporary buffer that 'ispell-region' uses to hold the
  11. filtered region")
  12.  
  13. (defvar ispell-program-name "ispell" "\
  14. *Program invoked by ispell-word and ispell-region commands.")
  15.  
  16. (defvar ispell-dictionary nil "\
  17. *Personal dictionary file containing a list of words, one to a line.
  18. If nil, defaults to ispell's normal default (usually ~/.ispell_words).")
  19.  
  20. (defvar ispell-words-have-boundaries t "\
  21. *If nil, a misspelled word matches embedded words too.  This is useful in
  22. nroff/troff, where a misspelled word may be hidded (e.g.,  Iword B), and a
  23. pain otherwise.")
  24.  
  25. (defvar ispell-highlight nil "\
  26. *If non-nil, misspelled words are highlighted.  See the function highlight-region.")
  27.  
  28. (defvar ispell-syntax-table nil "\
  29. *Syntax table used by ispell to find word boundaries.  You may change syntax
  30. entries to, say, allow ' and - to be part of words, or not, as you prefer.")
  31.  
  32. (if (null ispell-syntax-table) (progn (setq ispell-syntax-table (make-syntax-table)) (modify-syntax-entry 48 ".   " ispell-syntax-table) (modify-syntax-entry 49 ".   " ispell-syntax-table) (modify-syntax-entry 50 ".   " ispell-syntax-table) (modify-syntax-entry 51 ".   " ispell-syntax-table) (modify-syntax-entry 52 ".   " ispell-syntax-table) (modify-syntax-entry 53 ".   " ispell-syntax-table) (modify-syntax-entry 54 ".   " ispell-syntax-table) (modify-syntax-entry 55 ".   " ispell-syntax-table) (modify-syntax-entry 56 ".   " ispell-syntax-table) (modify-syntax-entry 57 ".   " ispell-syntax-table) (modify-syntax-entry 36 ".   " ispell-syntax-table) (modify-syntax-entry 37 ".   " ispell-syntax-table)))
  33.  
  34. (defun ispell-word (&optional quietly) "\
  35. Check spelling of word at or before dot.
  36. If word not found in dictionary, display possible corrections in a window 
  37. and let user select." (interactive) (byte-code "וêכ ⑧ו⑨וəווולÄèמ╱!êנס!?à#עסeפ#êעצeפ#êקרוז#å5שת!êןך!①םך!②ף    
  38. \"ë③))êץ ê    åU§∧∞♪!\"êè
  39. qêα♪♪βP\"êdbêΓhπ\"àuΣ♪!êécêebêσף`µ ê`\"!ë④)ê ז=âÜ    åù§τ∞♪!\"éה ;âã    å¡§Φ∞♪!∞ !#éהΘ ♪\"ë⑤ê
  40. àה
  41. bêΩ    
  42. \"êδ
  43. !ê .╱ç" [current-syntax start end word poss replace ispell-syntax-table nil t quietly ispell-out-name ispell-process syntax-table ((byte-code "IJ✓!ç" [current-syntax set-syntax-table] 2)) set-syntax-table looking-at "\\w" re-search-backward stay "\\W" re-search-forward "\\w+" error "No word to check." match-beginning 0 match-end buffer-substring ispell-init-process message "Checking spelling of %s..." upcase send-string "
  44. " /= 10 accept-process-output ispell-parse-output end-of-line "Checking spelling of %s... correct" "Checking spelling of %s... correct (derived from %s)" ispell-choose delete-region insert-string] 28))
  45.  
  46. (defun ispell-choose (choices word) "\
  47. Display possible corrections from list CHOICES.  Return chosen word
  48. if one is chosen, or nil to keep original WORD." (byte-code "מÄנï)ç" [count line words choices window-min-height char num result mode-line-format word nil t ispell-process help-char ((byte-code "ijIJ!ç" [bury-buffer " *Choices*"] 2)) ((byte-code "מנ♪נטטט◆╱ə⑨⑧èסע!qêפ êצק    !רQë⑥✓ê
  49. àWשתi
  50. @G#ן Xâ9טé@ךcê    Të①êםף✓ץ\\§
  51. @∧%ê
  52. A②✓Të⓪êé$ê✓מUà`∞c)êα    !êβע!êΓπ !êיΣσק    !\"êrë⑤ê
  53. ץZë⑥╱ê
  54. µUåî
  55. τUâÿΦ    !êטé2⇧
  56. ΘUâ†Ω δ    ךQ\"êΩ ∮    ךQ\"êΦ    !êטé2⇧
  57. ϕUâקΩ ∮    ךQ\"êΦ    !êטé2⇧
  58. ∈Uâ∮Φ    !ê∩≡±ק    !\"ט\"é2⇧╱מYà≈╱✓Wâ╱⇧Φ    !ê╱♪8é2⇧
  59. ≥Uâ⑤⇧è≤ )êיé2⇧
  60. Uå⇧
  61. ⌠Uâ.⇧Σ⌡!ê÷≈!êיé2⇧° êיë⑥◆=à>⇧טêéoê◆.◆ç" [count line words choices window-min-height char num result mode-line-format word nil t ispell-process help-char 0 2 get-buffer-create " *Choices*" erase-buffer "--  %b (Type number to select replacement for " upcase ")  --" + 7 window-width "
  62. " insert "(" 48 ") " "  " "(none)" overlay-window switch-to-buffer select-window next-window message "%s: a(dd), c(orrect), r(eplace), space or s(kip) [default], ? (help)" 32 115 ispell-ignore-later-occurrences 97 send-string "*" "@" 99 114 read-string format "Replacement for %s: " 18 recursive-edit 63 "a(dd to dict), c(orrect for this session), r(eplace with your word), or number of replacement" sit-for 3 ding] 30))] 1))
  63.  
  64. (defun ispell-ignore-later-occurrences (word) (byte-code "א✓!à⑥è✓qêèבג    דQה    P\"))ç" [ispell-temp-name word get-buffer replace-regexp "^" "$" "+"] 5))
  65.  
  66. (defun overlay-window (height) "\
  67. Create a (usually small) window with HEIGHT lines and avoid
  68. recentering." (byte-code "èèג ê`)èד
  69. !ê`)ה⑨⑧✓    Wà✓ë①êו
  70. !ë③êז♪    \"+)ç" [oldot top height newin beginning-of-line move-to-window-line nil split-window-vertically set-window-start] 6))
  71.  
  72. (defvar ispell-process nil "\
  73. Holds the process object for 'ispell'")
  74.  
  75. (defun ispell-parse-output (output) "\
  76. Parse the OUTPUT string of 'ispell' and return either t for an exact
  77. match, a string containing the root word for a match via suffix
  78. removal, a list of possible correct spellings, or nil for a complete
  79. miss." (byte-code "ה✓ו\"â♪IJéXה✓ז\"â⑥אéXה✓חטOי\"â'✓כאOéXאה✓ל\"?àUמנ✓\"מס✓ # àH✓
  80. O♪Bë③ê✓
  81. TאOë⓪*êé)ê♪)ç" [output t nil choice-list start end string= "*" "#" 0 1 "+" 2 "" string-match "[A-z]" " \\|$"] 10))
  82.  
  83. (defun ispell-init-process nil "\
  84. Check status of 'ispell' process and start if necessary." (byte-code "✓à    ג✓!ד=â⑥è    qêה )éN✓â וז!é#וח!êט êי    !à0כ    !êלמנ    
  85. ♪âAס♪עEéCעC%ë⓪êפ✓!êצק!ç" [ispell-process ispell-out-name ispell-program-name ispell-dictionary process-status run erase-buffer message "Restarting dead ispell process..." "Starting new ispell process..." ispell-check-version-compatibility get-buffer kill-buffer apply start-process "ispell" "-p" "-A" process-kill-without-query sit-for 3] 15))
  86.  
  87. (defun ispell-check-version-compatibility nil (byte-code "ה    !⑧è✓qêו êז
  88. בגבח%êebêט
  89. בג#â\"גéCטיבכ#â?למ
  90.  
  91. נ`סעבכ#ê`פZ\"%éCלצ
  92. \"))ç" [buffer ispell-out-name ispell-program-name nil t ispell-version get-buffer-create erase-buffer call-process "-v" search-forward "Version " move error "Incompatible version of %s (expected %s, but \"%s -v\" returned %s)" buffer-substring re-search-forward "[^0-9.]" 1 "Old version of %s (doesn't handle -v option)"] 16))
  93.  
  94. (defvar ispell-filter-hook "tr" "\
  95. *Filter to pass a region through before sending it to ispell.
  96. Must produce output one word per line.  Typically this is set to tr,
  97. deroff, detex, etc.")
  98.  
  99. (make-variable-buffer-local (quote ispell-filter-hook))
  100.  
  101. (defvar ispell-filter-hook-args (quote ("-cs" "A-Za-z" "
  102. ")) "*Argument LIST to pass to ispell-filter-hook")
  103.  
  104. (make-variable-buffer-local (quote ispell-filter-hook-args))
  105.  
  106. (defvar ispell-filter-hook-produces-single-column t "\
  107. *This is nil if your ispell-filter-hook does not output one word per line.")
  108.  
  109. (defun ispell-region (start end) "\
  110. Check a region for spelling errors interactively.  The variable
  111. which should be buffer or mode specific ispell-filter-hook is called
  112. to filter out text processing commands." (interactive "r") (byte-code "סêpןך!ם♪!ף ץססססס
  113.     ✓◆╱ə⑨⑧§ ê∧♪!ë⑥
  114. ê∞Äèîαβ!ê✓qêΓ 
  115. \"êπΣ!êσ!ê
  116. qêµ ê✓qêτΦΘΩ 
  117. ס
  118. ס&╱①\"\"ê bê
  119. qê②?à|Φedδצצס∮ϕ∈&    êdbê∩h≡\"àë∈cêebêg≡Uàܱץ!êéìê≥ed    סץ%ê≤④⌠    ∈Q\"êα⌡÷④!\"êπΣ!êm?àב÷④!≈=à⇩
  120. qêdbê° ê`ë⑥    ê
  121. bê∙·    ץ#?° ê√
  122. `\"⑥⑤`ë⑤ê
  123. qêⁿ⑤!êα⌡÷④!\"êâ♪⇧m?à✓⇧²④!é⑧⇩³`¯ ê`\"ë⑥╱êü@ץ!ê
  124. qêüA³`¯ ê`\"!ë⑥◆êü@ץ!ê`ë⑤ê✓qê∙üBסצ⑤S$êüCüD╱ΣץO\"âd⇧üE╱ץסOסצ#é⑤⇩∙⑥âz⇧üFüG╱!üFQéÇ⇧üG╱!סצ#â⇩`
  125. üH╱סצ#êè` üIüJüK üL\"!êπΣ!ê⑦àÃ⇧üM 
  126. \"êüN◆╱\"ë⑥✓ê⑦àע⇧üO 
  127. \"))ê✓àⁿ⇧èüP⑥â≥⇧üFüG╱!üFQé°⇧üG╱!✓\"))é    ⇩αüQ╱\"êrêα⌡÷④!\"êπΣ!ê
  128. qêéÕ))).
  129. ç" [this-buf spell-file spell-buf ispell-temp-name current-syntax tracker word poss replace endbound ispell-out ispell-out-name start end ispell-syntax-table ispell-filter-hook nil ispell-filter-hook-args ispell-filter-hook-produces-single-column t ispell-process count ispell-words-have-boundaries ispell-highlight make-temp-name "/tmp/ispell" get-buffer-create syntax-table 1 ispell-init-process get-buffer ((byte-code "ב✓!ג=âדה!é①דו!êז    !êח
  130. !àט
  131. !ç" [ispell-process current-syntax spell-file process-status run message "Done." "Warning - ispell process died." set-syntax-table file-exists-p delete-file] 7)) message "Prefrobnicating..." narrow-to-region sit-for 0 set-syntax-table erase-buffer apply call-process-region append list "tr" "-cs" "A-Za-z" "
  132. " /= 10 delete-char write-region send-string "&Include_File&" "Looking for a misspelled word... (status: %s)" process-status run beginning-of-line re-search-forward "^[#&]" count-lines forward-line accept-process-output buffer-substring end-of-line forward-char ispell-parse-output "\\W*\\(\\w+\\)" string= "+" search-forward "\\b" regexp-quote search-backward recenter / window-height 2 highlight-region ispell-choose unhighlight-region query-replace-regexp "Can't find %s in original text -- Any key to continue"] 60))
  133.  
  134. (defun ispell-buffer nil "\
  135. Check the current buffer for spelling errors interactively.  The variable
  136. which should be buffer or mode specific ispell-filter-hook is called to
  137. filter out text processing commands." (interactive) (byte-code "ijêIJed\"ç" [nil ispell-region] 3))
  138.  
  139. (defun highlight-region (p1 p2) "\
  140. Highlight the current region.  You may have to rewrite this for your
  141. particular terminal." (interactive "r") (byte-code "דêה    
  142. \"ג⑧ו    
  143. \"êזח!ê✓cêזח!*ç" [s p1 p2 inverse-video t nil buffer-substring delete-region sit-for 0] 5))
  144.  
  145. (defun unhighlight-region (p1 p2) "\
  146. Unhighlight the current region.  See highlight-region." (interactive "r") (byte-code "גêד    
  147. \"ג⑧ה    
  148. \"êוז!ê✓cêוז!*ç" [s p1 p2 inverse-video nil buffer-substring delete-region sit-for 0] 5))
  149.  
  150. (defvar ispell-words-file "/usr/dict/words" "\
  151. *File used for ispell-complete-word command.  On 4.3bsd systems, try
  152. using \"/usr/dict/web2\" for a larger selection.  Apollo users may want to
  153. try \"/sys/dict\".")
  154.  
  155. (defun ispell-complete-word nil "\
  156. Look up word before point in dictionary (see the variable
  157. ispell-words-file) and try to complete it.  If in the middle of a word,
  158. replace the entire word." (interactive) (byte-code "גêזèחט!ê`)`\"⑧יכ!⑨èל♪!qêמ êנ✓ס\"å,עפגדגצ✓╱&◆êק רVâ;שת !é<ג)əן
  159. ✓\"◆◆àY    àPךט!êם✓!êף◆!,ç" [current-word in-word possibilities ispell-temp-name nil t ispell-words-file replacement buffer-substring backward-word 1 looking-at "\\w" get-buffer-create erase-buffer string= "" call-process "look" "-df" buffer-size 0 ispell-parse-output buffer-string ispell-choose kill-word search-backward replace-match] 15))
  160.